﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<%@ Import Namespace="B2B.Models" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

<h2>AdminManageQuote</h2>

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="HEAD" runat="server">
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="main_content" runat="server">
    <h4>Management Quote</h4>
    <table cellpadding="5" cellspacing="5" style="width: 100%" border="1">
         <tr>
            <th>File</th>
            <th>Product</th> 
            <th>Product Request</th>   
            <th>Email Sender</th>  
            <th>Email Receiver</th>  
            <th>Link</th>
             <th>Date</th>
            <th>Status</th>
        </tr>
    <% for (int i = 0; i < ((ArrayList)ViewData["DanhSachBaoGia"]).Count; i++) 
       {
           BaoGia bg = ((BaoGia)((ArrayList)ViewData["DanhSachBaoGia"])[i]);%>
       
        <tr>
            <td><%=bg.TapTin %></td>                     
            <td><%=bg.TenSanPham %></td>
            <td><%=bg.TenSanPhamMua %></td>
            <td><%=bg.EmailNguoiGui %></td>
            <td><%=bg.EmailNguoiNhan %></td>
            <td><%=bg.Link %></td>
            <td><%=bg.NgayBaoGia %></td>
            <td>
                    <% if(bg.TinhTrang==0)
                        { %>
                            <h6>Blocked</h6>
                    <% }
                        else 
                        { %>
                            <h6>Not Blocked</h6>
                    <% } %>
            </td>
            <%--<td><a href="AdminUpdateMember?id=<%=tv.MaTV %>&tinhtrang=-1">Update</a></td>--%>
        </tr>
    <% } %>
        <tr>
            <td colspan="9">
                <% 
                    int totalRow = (int)ViewData["TongBaoGia"];
                    int totalPage = 0;
                    int itemInPage = 10;
                    if (totalRow % itemInPage == 0)
                    {
                        totalPage = totalRow / itemInPage;
                    }
                    else
                    {
                        totalPage = (totalRow / itemInPage) + 1; 
                    }
                    for (int i = 1; i <= totalPage; i++)
                    { 
                        int cur_page = (int)ViewData["page"];
                        if(i == cur_page)
                        { %> 
                            <a href="/Admin/AdminManageQuote?id=<%= i %>">[<%= i %>]</a>
                     <% } 
                        else 
                        { %>
                            <a href="/Admin/AdminManageQuote?id=<%= i %>"><%= i %></a>
                     <% }
                    } 
                    %>
            </td>
        </tr>
    </table>
</asp:Content>
